package cn.iocoder.yudao.module.member.dal.mysql.activation;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.controller.admin.activation.vo.ActivationPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.activation.ActivationDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 激活码管理 Mapper
 *
 * @author Alan
 */
@Mapper
public interface ActivationMapper extends BaseMapperX<ActivationDO> {

    default PageResult<ActivationDO> selectPage(ActivationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ActivationDO>()
                .eqIfPresent(ActivationDO::getActivationCode, reqVO.getActivationCode())
                .betweenIfPresent(ActivationDO::getBeginTime, reqVO.getBeginTime())
                .betweenIfPresent(ActivationDO::getEndTime, reqVO.getEndTime())
                .betweenIfPresent(ActivationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ActivationDO::getId));
    }

}